package com.jgy.策略And工厂模式;

import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;

/**
 * @author 姜光远
 * @date 2022/12/15 10:27
 */
@AllArgsConstructor
public enum FactoryEnum {
    普通客户("1", "com.jgy.java.策略模式.ACountPrice","折扣为0.95折"),
    VIP客户("2","com.jgy.java.策略模式.BCountPrice","折扣为0.8折"),
    超级VIP客户("3","com.jgy.java.策略模式.CCountPrice","折扣为0.65折");

    private String code;
    private String value;
    private String desc;

    FactoryEnum(){

    }

    public static String getClassNameByCode(String code) {
        String value = "";
        if (StringUtils.isEmpty(code)) {
            return value;
        }
        for (FactoryEnum factoryEnum : FactoryEnum.values()) {
            if (factoryEnum.code.equalsIgnoreCase(code)){
                value = factoryEnum.value;
                break;
            }
        }
        return value;
    }

    public String getValue() {
        return value;
    }
    public String getCode(){
        return code;
    }
}
